##############################################################
## MOD Title: Effects Store
## MOD Author: Thoul < thoul@phpbbsmith.com > (Jeremy Rogers) http://www.phpbbsmith.com
## MOD Description: Adds a special effects store to Shop 3.
## MOD Version: 2.0.1
##
## Installation Level: Intermediate
## Installation Time: 15 Minutes
## Files To Edit:
##		common.php,
##		index.php,
##		privmsg.php,
##		viewforum.php,
##		viewonline.php,
##		viewtopic.php,
##		includes/page_header.php,
##		includes/usercp_register.php,
##		includes/usercp_viewprofile.php,
##		language/lang_english/lang_admin.php
##		templates/subSilver/profile_add_body.tpl,
##		templates/subSilver/profile_view_body.tpl,
##		templates/subSilver/viewtopic_body.tpl,
## Included Files:
##		install.php,
##		shop_effects.php,
##		admin/effects_config.php,
##		language/lang_english/lang_effects.php,
##		mods/effects_store/change_name.php,
##		mods/effects_store/class_base.php,
##		mods/effects_store/class_display.php,
##		mods/effects_store/class_template_ext.php,
##		mods/effects_store/colors.js,
##		mods/effects_store/equip.php,
##		mods/effects_store/exchange.php,
##		mods/effects_store/item_display.php,
##		shop/images/Avatar Ticket.gif,
##		shop/images/Name Tag.gif,
##		shop/images/pallete_bgcolor.gif,
##		shop/images/pallete_color.gif,
##		shop/images/pallete_glow.gif,
##		shop/images/pallete_shadow.gif,
##		shop/images/Signature Ticket.gif,
##		shop/images/Title Badge.gif,
##		shop/images/Title Stamp.gif,
##		shop/images/Title Tag.gif,
##		templates/subSilver/admin/shop_effects_config.tpl,
##		templates/subSilver/shop/effects_backlinks.tpl,
##		templates/subSilver/shop/effects_buy.tpl,
##		templates/subSilver/shop/effects_changename.tpl,
##		templates/subSilver/shop/effects_color_details.tpl,
##		templates/subSilver/shop/effects_html.tpl,
##		templates/subSilver/shop/effects_inventory.tpl,
##		templates/subSilver/shop/effects_item_details.tpl,
##		templates/subSilver/shop/effects_itemlist.tpl,
##		templates/subSilver/shop/effects_message.tpl,
##		templates/subSilver/shop/effects_sell.tpl,
##		templates/subSilver/shop/effects_title.tpl
## License: contrib/license.txt GNU General Public License v2
##############################################################
## Author Notes:
##
## Effects Store adds a special effects shop to Zarath's Shop 3.1.  If you've
## used effects shops in earlier versions of Shop, you'll find that this one is
## laid out quite differently, but has most of the same features and a lot of
## new ones.
##
## Before installing this modification, you should have a working install of
## Shop 3.1.x and a Points or Cash modification.  This mod is NOT compatible
## with Shop 2.x or Shop 3.0.x.
##
## If you have any problems with using the modification, or would like to read
## additional instructions on how to use features of Effects Store, please see
## the contrib/user_guide.txt file for help.  I have tried to answer some of
## the more common and expected questions there.
##
##############################################################
## BEFORE FOLLOWING THESE INSTRUCTIONS, YOU SHOULD BACK UP ALL RELATED FILES.
##############################################################

#
#-----[ COPY ]------------------------------------------
#

copy root/*.* to *.*

#
#-----[ DIY INSTRUCTIONS ]------------------------------------------
#

Run install.php by visiting it in your web browser, for example
http://www.yoursite.com/phpBB2/install.php
This will install the database portions of the hack. If you prefer to run the
queries manually, check the contrib/ directory for install.sql.

If you intend to use the Change Username privilege of this modification, you
should probably disable username changes from the user profile editor.  You
can do that in the phpBB Administration Panel > General > Configuration page.

#
#-----[ OPEN ]------------------------------------------
#
# You may have already done the edits to this file for one of my other
# modifications.  If so, you don't need to repeat this again.  You can
# safely skip to the next file.
#
common.php

#
#-----[ FIND ]------------------------------------------
#

<?php

#
#-----[ AFTER, ADD ]------------------------------------------
#

// This file modified for Secure Superglobals

#
#-----[ FIND ]--------------------------------------
#

//
// Define some basic configuration arrays this also prevents
// malicious rewriting of language and otherarray values via
// URI params
//

#
#-----[ BEFORE, ADD ]--------------------------------------
#

//----------------------------------------------------------------------
// Secure Superglobals - Begin Code Alteration
//
// Since the long $HTTP_* arrays have been secured and slashed as needed,
// let's set the matching superglobals to their values. That will allow us
// to use the superglobals instead of the long arrays, with no worries about
// supposed security or slashing issues.
$_POST		= $HTTP_POST_VARS;
$_GET		= $HTTP_GET_VARS;
$_COOKIE	= $HTTP_COOKIE_VARS;
//
// Secure Superglobals - End Code Alteration
//----------------------------------------------------------------------


#
#-----[ OPEN ]------------------------------------------
#
index.php

#
#-----[ FIND ]------------------------------------------
#

<?php

#
#-----[ AFTER, ADD ]------------------------------------------
#

// This file modified for Effects Store

#
#-----[ FIND ]--------------------------------------
#

$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//

#
#-----[ AFTER, ADD ]--------------------------------------
#

//------------------------------------------------------------------------------
// Effects Store - Begin Code Alteration
//
require_once($phpbb_root_path . 'mods/effects_store/class_display.' . $phpEx);
//
// Effects Store - End Code Alteration
//------------------------------------------------------------------------------

#
#-----[ FIND ]------------------------------------------
#

		$forum_moderators[$row['forum_id']][] = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&amp;" . POST_USERS_URL . "=" . $row['user_id']) . '">' . $row['username'] . '</a>';

#
#-----[ BEFORE, ADD ]------------------------------------------
#

//------------------------------------------------------------------------------
// Effects Store - Begin Code Alteration
//
		$row['username'] = $effects->name_check('moderators', $row);
//
// Effects Store - End Code Alteration
//------------------------------------------------------------------------------

#
#-----[ FIND ]------------------------------------------
#

	//
	// Let's decide which categories we should display
	//

#
#-----[ BEFORE, ADD ]------------------------------------------
#

//------------------------------------------------------------------------------
// Effects Store - Begin Code Alteration
//
	$effects->full_name_check($newest_userdata, '', 'newestuser', 'NEWEST_USER');
//
// Effects Store - End Code Alteration
//------------------------------------------------------------------------------

#
#-----[ FIND ]------------------------------------------
#

								$last_post = $last_post_time . '<br />';

#
#-----[ AFTER, ADD ]------------------------------------------
#

//------------------------------------------------------------------------------
// Effects Store - Begin Code Alteration
//
								$forum_data[$j]['username'] = $effects->name_check('lastpost', $forum_data[$j]);
//
// Effects Store - End Code Alteration
//------------------------------------------------------------------------------

#
#-----[ OPEN ]------------------------------------------
#
privmsg.php

#
#-----[ FIND ]------------------------------------------
#

<?php

#
#-----[ AFTER, ADD ]------------------------------------------
#

// This file modified for Effects Store

#
#-----[ FIND ]------------------------------------------
#

//
// Var definitions
//

#
#-----[ BEFORE, ADD ]------------------------------------------
#

//------------------------------------------------------------------------------
// Effects Store - Begin Code Alteration
//
require_once($phpbb_root_path . 'mods/effects_store/class_display.' . $phpEx);
//
// Effects Store - End Code Alteration
//------------------------------------------------------------------------------

#
#-----[ FIND ]------------------------------------------
#

	else
	{
		$user_sig = '';
	}

#
#-----[ AFTER, ADD ]------------------------------------------
#

//------------------------------------------------------------------------------
// Effects Store - Begin Code Alteration
//
	if( !$effects->priv_check($privmsg['privmsgs_from_userid'], 'sig') )
	{
		$user_sig = '';
	}
//
// Effects Store - End Code Alteration
//------------------------------------------------------------------------------

#
#-----[ FIND ]------------------------------------------
#

		'YIM_IMG' => $yim_img,
		'YIM' => $yim)
	);

#
#-----[ AFTER, ADD ]------------------------------------------
#

//------------------------------------------------------------------------------
// Effects Store - Begin Code Alteration
//
	$effects->pm_message_check($privmsg);
//
// Effects Store - End Code Alteration
//------------------------------------------------------------------------------

#
#-----[ FIND ]------------------------------------------
#

	}
	while( $row = $db->sql_fetchrow($result) );

#
#-----[ BEFORE, ADD ]------------------------------------------
#

//------------------------------------------------------------------------------
// Effects Store - Begin Code Alteration
//
		$effects->full_name_check($row, 'listrow', 'pm_list', 'FROM');
//
// Effects Store - End Code Alteration
//------------------------------------------------------------------------------

#
#-----[ OPEN ]------------------------------------------
#
viewforum.php

#
#-----[ FIND ]------------------------------------------
#

<?php

#
#-----[ AFTER, ADD ]------------------------------------------
#

// This file modified for Effects Store

#
#-----[ FIND ]------------------------------------------
#

//
// Start session management
//
$userdata = session_pagestart($user_ip, $forum_id);
init_userprefs($userdata);
//
// End session management
//

#
#-----[ AFTER, ADD ]------------------------------------------
#

//------------------------------------------------------------------------------
// Effects Store - Begin Code Alteration
//
require_once($phpbb_root_path . 'mods/effects_store/class_display.' . $phpEx);
//
// Effects Store - End Code Alteration
//------------------------------------------------------------------------------

#
#-----[ FIND ]------------------------------------------
#

			'LAST_POST_AUTHOR' => $last_post_author, 
			'LAST_POST_IMG' => $last_post_url, 

			'L_TOPIC_FOLDER_ALT' => $folder_alt, 

			'U_VIEW_TOPIC' => $view_topic_url)
		);

#
#-----[ AFTER, ADD ]------------------------------------------
#

//------------------------------------------------------------------------------
// Effects Store - Begin Code Alteration
//
	$effects->topic_check($topic_rowset[$i]);
//
// Effects Store - End Code Alteration
//------------------------------------------------------------------------------

#
#-----[ OPEN ]------------------------------------------
#
viewonline.php

#
#-----[ FIND ]------------------------------------------
#

<?php

#
#-----[ AFTER, ADD ]------------------------------------------
#

// This file modified for Effects Store

#
#-----[ FIND ]------------------------------------------
#

//
// Output page header and load viewonline template
//

#
#-----[ BEFORE, ADD ]------------------------------------------
#

//------------------------------------------------------------------------------
// Effects Store - Begin Code Alteration
//
require_once($phpbb_root_path . 'mods/effects_store/class_display.' . $phpEx);
//
// Effects Store - End Code Alteration
//------------------------------------------------------------------------------

#
#-----[ FIND ]------------------------------------------
#

		$$which_counter++;

#
#-----[ BEFORE, ADD ]------------------------------------------
#

//------------------------------------------------------------------------------
// Effects Store - Begin Code Alteration
//
		$effects->full_name_check($row, $which_row, 'online', 'USERNAME');
//
// Effects Store - End Code Alteration
//------------------------------------------------------------------------------

#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php

#
#-----[ FIND ]------------------------------------------
#

<?php

#
#-----[ AFTER, ADD ]------------------------------------------
#

// This file modified for Effects Store

#
#-----[ FIND ]------------------------------------------
#

//
// Start session management
//
$userdata = session_pagestart($user_ip, $forum_id);
init_userprefs($userdata);
//
// End session management
//

#
#-----[ AFTER, ADD ]------------------------------------------
#

//------------------------------------------------------------------------------
// Effects Store - Begin Code Alteration
//
require_once($phpbb_root_path . 'mods/effects_store/class_display.' . $phpEx);
//
// Effects Store - End Code Alteration
//------------------------------------------------------------------------------

#
#-----[ FIND ]------------------------------------------
#

		'U_POST_ID' => $postrow[$i]['post_id'])
	);

#
#-----[ AFTER, ADD ]------------------------------------------
#

//------------------------------------------------------------------------------
// Effects Store - Begin Code Alteration
//
	$effects->post_check($postrow[$i]);
//
// Effects Store - End Code Alteration
//------------------------------------------------------------------------------

#
#-----[ OPEN ]------------------------------------------
#
includes/page_header.php

#
#-----[ FIND ]------------------------------------------
#

<?php

#
#-----[ AFTER, ADD ]------------------------------------------
#

// This file modified for Effects Store

#
#-----[ FIND ]------------------------------------------
#

if (defined('SHOW_ONLINE'))
{

#
#-----[ AFTER, ADD ]------------------------------------------
#

//------------------------------------------------------------------------------
// Effects Store - Begin Code Alteration
//
	require_once($phpbb_root_path . 'mods/effects_store/class_display.' . $phpEx);
//
// Effects Store - End Code Alteration
//------------------------------------------------------------------------------

#
#-----[ FIND ]------------------------------------------
#

				if ( $row['user_allow_viewonline'] || $userdata['user_level'] == ADMIN )
				{

#
#-----[ AFTER, ADD ]------------------------------------------
#

//------------------------------------------------------------------------------
// Effects Store - Begin Code Alteration
//
					$effects->online_check($user_online_link, $row);
//
// Effects Store - End Code Alteration
//------------------------------------------------------------------------------

#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_register.php

#
#-----[ FIND ]------------------------------------------
#

<?php

#
#-----[ AFTER, ADD ]------------------------------------------
#

// This file modified for Effects Store

#
#-----[ FIND ]------------------------------------------
#

		if ( $userdata['user_allowavatar'] && ( $board_config['allow_avatar_upload'] || $board_config['allow_avatar_local'] || $board_config['allow_avatar_remote'] ) )

#
#-----[ BEFORE, ADD ]------------------------------------------
#

/*------------------------------------------------------------------------------
// Effects Store - Begin Code Alteration
//		Added:  $effect_check['avatar'] && 
//		Original phpBB Code:
		if ( $userdata['user_allowavatar'] && ( $board_config['allow_avatar_upload'] || $board_config['allow_avatar_local'] || $board_config['allow_avatar_remote'] ) )
*/
		require_once($phpbb_root_path . 'mods/effects_store/class_display.' . $phpEx);

#
#-----[ IN-LINE FIND ]------------------------------------------
#

$userdata['user_allowavatar']

#
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------
#

$effects->profile_edit_check($userdata) && 

#
#-----[ AFTER, ADD ]------------------------------------------
#

//
// Effects Store - End Code Alteration
//------------------------------------------------------------------------------

#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_viewprofile.php

#
#-----[ FIND ]------------------------------------------
#

<?php

#
#-----[ AFTER, ADD ]------------------------------------------
#

// This file modified for Effects Store

#
#-----[ FIND ]------------------------------------------
#

$template->pparse('body');

#
#-----[ BEFORE, ADD ]------------------------------------------
#

//------------------------------------------------------------------------------
// Effects Store - Begin Code Alteration
//
require_once($phpbb_root_path . 'mods/effects_store/class_display.' . $phpEx);
$effects->profile_check($profiledata);
//
// Effects Store - End Code Alteration
//------------------------------------------------------------------------------

#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_admin.php

#
#-----[ FIND ]------------------------------------------
#

<?php

#
#-----[ AFTER, ADD ]------------------------------------------
#

// This file modified for Effects Store

#
#-----[ FIND ]------------------------------------------
#

?>

#
#-----[ BEFORE, ADD ]------------------------------------------
#

//------------------------------------------------------------------------------
// Effects Store - Begin Code Alteration
//
$lang['EFFECTS_NAV']		= 'Effects Configuration';
$lang['EFFECTS_NAV_desc']	= 'Configuration settings for Effects Store.';
//
// Effects Store - End Code Alteration
//------------------------------------------------------------------------------

#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/profile_add_body.tpl

#
#-----[ FIND ]------------------------------------------
#
# First line of the file.
#

<form action="{S_PROFILE_ACTION}" {S_FORM_ENCTYPE} method="post">

#
#-----[ BEFORE, ADD ]------------------------------------------
#

<!-- This file modified for Effects Store -->

#
#-----[ FIND ]------------------------------------------
#

	<tr> 
	  <td class="row1"><span class="gen">{L_SIGNATURE}:</span><br /><span class="gensmall">{L_SIGNATURE_EXPLAIN}<br /><br />{HTML_STATUS}<br />{BBCODE_STATUS}<br />{SMILIES_STATUS}</span></td>
	  <td class="row2"> 
		<textarea name="signature" style="width: 300px" rows="6" cols="30" class="post">{SIGNATURE}</textarea>
	  </td>
	</tr>

#
#-----[ BEFORE, ADD ]------------------------------------------
#

<!-- BEGIN effects_signature -->

#
#-----[ AFTER, ADD ]------------------------------------------
#

<!-- END effects_signature -->

#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/profile_view_body.tpl

#
#-----[ FIND ]------------------------------------------
#
# First line of the file.
#

<table width="100%" cellspacing="2" cellpadding="2" border="0" align="center">

#
#-----[ BEFORE, ADD ]------------------------------------------
#

<!-- This file modified for Effects Store -->

#
#-----[ FIND ]------------------------------------------
#
# This may be part of a longer line in some templates.
#

{POSTER_RANK}

#
#-----[ IN-LINE FIND ]------------------------------------------
#

{POSTER_RANK}

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#

<br />{POSTER_EFFECTS_TITLE}

#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/viewtopic_body.tpl

#
#-----[ FIND ]------------------------------------------
#
# First line of the file.
#

<table width="100%" cellspacing="2" cellpadding="2" border="0">

#
#-----[ BEFORE, ADD ]------------------------------------------
#

<!-- This file modified for Effects Store -->

#
#-----[ FIND ]------------------------------------------
#
# This may be part of a longer line in some templates.
#

{postrow.POSTER_RANK}

#
#-----[ IN-LINE FIND ]------------------------------------------
#

{postrow.POSTER_RANK}

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#

<br />{postrow.POSTER_EFFECTS_TITLE}

#
#-----[ FIND ]------------------------------------------
#
# This line may be different in some templates.
#

				<td colspan="2"><span class="postbody">{postrow.MESSAGE}{postrow.SIGNATURE}</span><span class="gensmall">{postrow.EDITED_MESSAGE}</span></td>

#
#-----[ IN-LINE FIND ]------------------------------------------
#

<td colspan="2"

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#

 style="{postrow.EFFECTS_POST_STYLE}"

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM